﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Navigation;

namespace Nok_Air
{
    public partial class TermsConditions : PhoneApplicationPage
    {
        private string lastnamePar = "";
        private string indexAvailabilityItemsPar = "";
        private string roundtripFlag = "";
        
        private string FlightsXMLStringPar = "";
        private string RegisterIdPar = "";
        private string PaymentTypePar = "";
        private string PassengerXMLPar = "";
        private string ContactXMLPar = "";
        public TermsConditions()
        {
            DataContext = App.ViewModel;
            InitializeComponent();
        }

        private void continueButton_Click(object sender, RoutedEventArgs e)
        {
            if (!acceptRBT.IsChecked.Value) return;

         /*   Nok_Air.WS.NokAirServicesHelper nokSHelp = new Nok_Air.WS.NokAirServicesHelper();
            nokSHelp.GetSubmitBookingStatus(Nok_Air.App.ViewModel.SubmitBookingV2Result);
          */
            NavigationService.Navigate(new Uri("/BookFlight/7Confirm.xaml?lastnamePar=" + lastnamePar + "&indexAvailabilityItems=" + indexAvailabilityItemsPar + "&roundtripFlag=" + roundtripFlag + "&FlightsXMLStringPar=" + FlightsXMLStringPar + "&PassengerXMLPar=" + PassengerXMLPar + "&PaymentTypePar=" + PaymentTypePar + "&ContactXMLPar=" + ContactXMLPar + "&RegisterIdPar=" + RegisterIdPar, UriKind.Relative));
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (NavigationService.CanGoBack && App.ViewModel.IsFinishTransaction)
            {
                NavigationService.GoBack();
            }

            NavigationContext.QueryString.TryGetValue("indexAvailabilityItems", out indexAvailabilityItemsPar);
            NavigationContext.QueryString.TryGetValue("lastnamePar", out lastnamePar);
            NavigationContext.QueryString.TryGetValue("roundtripFlag", out roundtripFlag);

            NavigationContext.QueryString.TryGetValue("FlightsXMLStringPar", out FlightsXMLStringPar);
            NavigationContext.QueryString.TryGetValue("RegisterIdPar", out RegisterIdPar);
            NavigationContext.QueryString.TryGetValue("PaymentTypePar", out PaymentTypePar);
            NavigationContext.QueryString.TryGetValue("PassengerXMLPar", out PassengerXMLPar);
            NavigationContext.QueryString.TryGetValue("ContactXMLPar", out ContactXMLPar);
        }
    }
}
